﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Logic
{
    public static class Constants
    {
        public const String ConduitKey = "conduit";
        public const String ContainerKey = "container";
        public const String ClarizenEntityUrlFormat = "https://app.clarizen.com/Clarizen/View/?id={0}&type={1}";
        public const String googleID = "googleID";

        public const String DefaultImportance = "Normal";
        public const String DefaultStatus = "On Track";
        public const String DefaultState = "Draft";
        public const String DefaultTaskType = "General";
        public const String DefaultDocumentType = "General";

        public const String DEFAULT_TASK_CONTAINER = "General Tasks";

        //public const String ResetAccessTokenKey = "ResetAccessToken";

        public static String CurrentUrl
        {
            get
            {
                var url = HttpContext.Current.Request.Url;
                var scheme = "https";
                if (url.Authority.StartsWith("localhost", StringComparison.OrdinalIgnoreCase))
                    scheme = url.Scheme;

                var appPath = HttpContext.Current.Request.ApplicationPath;

                return String.Format("{0}://{1}", scheme, url.Authority) + (IsGmailCanvas ? "/gmail/canvas" : IsGmail ? "/gmail" : "") +
                    (appPath.Length > 1 ? ("/" + appPath) : "");
            }
        }

        public static Boolean IsGmail
        {
            get { return HttpContext.Current.Request.Url.AbsolutePath.ToLower().StartsWith("/gmail"); }
        }

        public static Boolean IsGmailCanvas
        {
            get { return HttpContext.Current.Request.Url.AbsolutePath.ToLower().StartsWith("/gmail/canvas/"); }
        }

        public const String LoginKey = "LoggedIn";
    }
}
